set -e

source ./make_openssl_3.0.7.sh

for i in {1..10000}
do
    $openssl genpkey -algorithm x25519 -out x25519key.pem
    $openssl pkey -in x25519key.pem -text -noout -out keypair.txt
    TrimOpensslText keypair.txt
    public_key=$(GetNthLine keypair.txt 6)
    echo $public_key
    if [[ $public_key =~ ^00 ]]
    then
        echo "!!!!found!!!! iteration times: " $i
        break
    fi
done

$openssl pkey -in x25519key.pem -pubout -out x25519pubkey.pem
cat x25519pubkey.pem
$openssl pkey -pubin -in x25519pubkey.pem -outform DER -out x25519pubkey.der
FileHexDump x25519pubkey.der
